<template>
	<!-- 文章详情 -->
	<view :class="model+'-wrap'">
		<view :class="'p-sticky-'+model">
			<view class="status_bar">
		
			</view>
			<view class="nav_bar flex align-center justify-between">
				<view @click="$tool.goBack()" class="f0 p-3">
					<image class="fanhui_icon" :src="'/static/images/fanhui_'+model+'.png'" mode=""></image>
				</view>
				<view class="A-Medium" :class="'navTitle_'+model">
					
				</view>
				<view class="f0 p-3 opacity0">
					<image class="fanhui_icon" :src="'/static/images/fanhui_'+model+'.png'" mode=""></image>
				</view>
			</view>
		</view>
		<view class="h32">
			
		</view>
		<view class="title mx-3 A-Medium" :class="model=='light'?'titleLight':''">
			{{title}}
		</view>
		<view class="flex align-center mt-3 mx-3 desc mb-4 A-Regular">
			<view class="mr-3">
				{{createBy}}
			</view>
			<view class="">
				{{createTime}}
			</view>
		</view>
		<view class="mx-3 A-Regular content" :class="model=='light'?'contentLight':''" v-html="content">
			
		</view>
	</view>
</template>

<script>
	import {
		newsQueryById
	} from '@/core/api/index.js';
	export default {
		data(){
			return {
				title:'',
				createBy:'',
				createTime:'',
				content:''
				
			}
		},
		onLoad(options) {
			newsQueryById({
				id:options.id
			}).then(res=>{
				console.log(res,'cs');
				this.title = res.result.title;
				this.createBy = res.result.createBy;
				this.createTime = res.result.createTime;
				this.content = res.result.content;
			})
		},
		onReady() {
			this.$tool.setStatusBarStyle(this.model);
		},
		onShow() {
			this.$tool.setStatusBarStyle(this.model);
			const pages = getCurrentPages();
			const page = pages[pages.length - 1];
			const currentWebview = page.$getAppWebview();
			if(this.model == "dark"){
				currentWebview.setStyle({
					background: "#0E0F11"
				});
			}else{
				currentWebview.setStyle({
					background: "#ffffff"
				});
			}
		},
		computed: {
			i18n() {
				return this.$t('mine');
			},
			model() {
				return this.$store.state.config.model;
			}
		},
	}
</script>

<style scoped lang="scss">
	.h32 {
		height: 32rpx;
	}
	.title {
		font-size: 38rpx;
		color: #F7F7F7;
	}
	.titleLight {
		color: #0E0F11;
	}
	.desc {
		font-size: 24rpx;
		color: #7F838D;
	}
	.content {
		font-size: 30rpx;
		color: #AAACB8;
	}
	.contentLight {
		color: #47474A;
	}
</style>